package com.abu.aclms.controller;


import com.abu.aclms.pojo.PermissionVo;
import com.abu.aclms.service.PermissionService;
import com.abu.utils.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 权限 前端控制器
 * </p>
 *
 * @author 阿布
 * @since 2020-06-27
 */
@RestController
@RequestMapping("/aclms/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @GetMapping("{pid}")
    public Resp queryAllPermission(@PathVariable("pid") String pid) {

        List<PermissionVo> categoryVoList = this.permissionService.queryAllPermission(pid);
        if (CollectionUtils.isEmpty(categoryVoList)) {
            return Resp.error();
        }
        return Resp.ok().data("categoryVo",categoryVoList);
    }

}

